package com.sleep.psy.external_server.business.psy.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sleep.psy.external_server.business.psy.entity.PsyScore;
import com.sleep.psy.external_server.business.psy.mapper.PsyScoreMapper;
import com.sleep.psy.external_server.business.psy.service.PsyScoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 分数因子表 服务实现类
 * </p>
 *
 * @author wenliguo
 * @since 2025-08-12
 */
@Service
public class PsyScoreServiceImpl extends ServiceImpl<PsyScoreMapper, PsyScore> implements PsyScoreService {

    @Autowired
    private PsyScoreMapper psyScoreMapper;

    /**
     * 通过报告id和量表code查询
     * @author wenliguo
     * @date 2025/7/9 17:24
     * @param reporeId 报告id
     * @param className 量表code
     * @return com.sleep.psy.main_server.business2.evaluation.entity.PsyScore
     */
    @Override
    public PsyScore selectScoreByReportIdAndClassName(Long reporeId, String className) {
        QueryWrapper<PsyScore> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("report_id", reporeId)
                .eq("class_name", className);
        return psyScoreMapper.selectOne(queryWrapper);
    }
}
